package com.kundi.dooradmin.service;

import com.kundi.dooradmin.entity.Team;
import com.kundi.dooradmin.mapper.TeamMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author 赵恒
 * Date 2020/7/10
 */
@Service
public class TeamService {
    @Resource
    TeamMapper teamMapper;

    public Integer insert(Team team) {
        return teamMapper.insertSelective(team);
    }

    public List<Team> getAll() {
        return teamMapper.getAll();
    }

    public Team getTeamById(Integer id) {
        Team team = new Team();
        team.setId(id);
        return teamMapper.selectOne(team);
    }

    public Team getTeamNoImage(Integer id) {
        return teamMapper.getTeamNoImage(id);
    }

    public Integer update(Team team) {
        return teamMapper.updateByPrimaryKeySelective(team);
    }

    public Integer delete(Integer id) {
        Team team = new Team();
        team.setId(id);
        return teamMapper.deleteByPrimaryKey(team);
    }
}
